package com.xsir.controller;


import com.xsir.common.Result;
import com.xsir.entity.Reply;
import com.xsir.service.IReplyService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 回复表 前端控制器
 * </p>
 *
 * @author xsir
 * @since 2020-11-08
 */
@RestController
@RequestMapping("/reply")
public class ReplyController {
    
    private IReplyService replyService;
    
    @Autowired
    public void setReplyService(IReplyService replyService) {
        this.replyService = replyService;
    }
    
    @RequiresRoles("user")
    @PostMapping("/article/saveOrUpdate")
    public Result article(@RequestBody Reply reply) {
        boolean b = replyService.saveOrUpdate(reply);
        return b ? Result.ok() : Result.error();
    }
}
